﻿using System;
using System.Globalization;
using System.Threading;
using System.Windows.Forms;
using Microsoft.Win32;

namespace Clock
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            SetAutoStartup();

            Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("zh-cn");
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("zh-cn");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new ClockForm());
        }

        private static void SetAutoStartup()
        {
            RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
            if ((key != null) && (key.GetValue("Clock") == null))
            {
                key.SetValue("Clock", Environment.CommandLine);
            }
        }
    }
}
